﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace FileDuplicateRemover.Core
{
    public class DuplicateEntityDescriptionList : List<DuplicateEntityDescription>
    {
        //private List<DuplicateEntityDescription> _EntityDescriptionList = new List<DuplicateEntityDescription>();

        public void Add(BaseEntity e)
        {
            DuplicateEntityDescription existingEntityDescription = this.Find(ed => ed.SomeEntity.Equals(e));

            if (existingEntityDescription != null)
            {
                existingEntityDescription.Add(e);
            }
            else
            {
                DuplicateEntityDescription ed = new DuplicateEntityDescription(e, this.Count.ToString());

                this.Add(ed);
            }
        }
    }
}
